<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="收款状态">
        <el-select v-model="queryParams.skStatus" placeholder="请选择" clearable>
          <el-option label="未收款" value="1"></el-option>
          <el-option label="已收款" value="2"></el-option>
          <el-option label="已中止" value="3"></el-option>
          <el-option label="已冻结" value="4"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="账单类型">
        <el-select v-model="queryParams.billType" placeholder="请选择" clearable>
          <el-option label="分期变更" value="1"></el-option>
          <el-option label="租约保理变更" value="2"></el-option>
          <el-option label="退租变更" value="3"></el-option>
          <el-option label="普通账单" value="4"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="租房合同编号">
        <el-input v-model="queryParams.contractNo" placeholder="请输入租房合同编号" clearable></el-input>
      </el-form-item>
      <div>
        <el-form-item label="应收日期">
          <div class="block">
            <el-date-picker
              v-model="queryParams.collectionDate"
              value-format="yyyy-MM-dd HH:mm:ss"
              type="datetime"
              clearable
              placeholder="选择日期时间">
            </el-date-picker>至
            <el-date-picker
              v-model="queryParams.collectionDate1"
              value-format="yyyy-MM-dd HH:mm:ss"
              type="datetime"
              placeholder="选择日期时间"
              clearable>
            </el-date-picker>至
          </div>
        </el-form-item>
      </div>
      <div>
        <el-form-item label="实收日期">
          <div class="block">
            <el-date-picker
              clearable
              v-model="queryParams.realCollectionDate"
              value-format="yyyy-MM-dd HH:mm:ss"
              type="datetime"
              placeholder="选择日期时间">
            </el-date-picker>至
            <el-date-picker
              clearable
              v-model="queryParams.realCollectionDate1"
              value-format="yyyy-MM-dd HH:mm:ss"
              type="datetime"
              placeholder="选择日期时间">
            </el-date-picker>至
          </div>
        </el-form-item>
      </div>

      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

   <!-- <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['finance:plan:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['finance:plan:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['finance:plan:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['finance:plan:export']"
        >导出</el-button>
      </el-col>
	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>-->

    <el-tabs v-model="activeName1" @tab-click="handleClick">
      <el-tab-pane label="房租收款计划" name="first">

        <p>应收金额总计: <span>{{this.amountReceivable}}</span> 元实收金额总计: <span>{{this.amountCollected}}</span> 元</p>

        <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="租房合同号" align="center" prop="contractNo" />
          <el-table-column label="收款单号" align="center" prop="receiptOrderNo" />
          <el-table-column label="承租房间(使用房源名称)" align="center" prop="roomName" />
          <el-table-column label="租客姓名" align="center" prop="tenantName" />
          <el-table-column label="小区名称" align="center" prop="premiseName" />
          <el-table-column label="支付金额" align="center" prop="paymentAmount" />
          <el-table-column label="第几期" align="center" prop="receiptNumber" />
          <el-table-column label="收款状态" align="center" prop="skStatus">
            <template slot-scope="scope">
              <span v-if="scope.row.skStatus==1">未收款</span>
              <span v-if="scope.row.skStatus==2">已收款</span>
              <span v-if="scope.row.skStatus==3">已中止</span>
              <span v-if="scope.row.skStatus==4">已冻结</span>
            </template>
          </el-table-column>
          <el-table-column label="账单类型" align="center" prop="billType">
            <template slot-scope="scope">
              <span v-if="scope.row.billType==1">分期变更</span>
              <span v-if="scope.row.billType==2">租约保理变更</span>
              <span v-if="scope.row.billType==3">退租变更</span>
              <span v-if="scope.row.billType==4">普通账单(正常房租租务计划)</span>
            </template>
          </el-table-column>
          <el-table-column label="预定收款日期" align="center" prop="collectionDate" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.collectionDate, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="实际收款日期" align="center" prop="realCollectionDate" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.realCollectionDate, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>


          <el-table-column label="商户ID" align="center" prop="businessId" />
          <el-table-column label="合同ID" align="center" prop="contractId" />
          <el-table-column label="合同类型1：收房合同，2：出房合同" align="center" prop="contractType" />
          <el-table-column label="解约协议ID" align="center" prop="tTerminationId" />
          <el-table-column label="楼盘ID" align="center" prop="premiseId" />
          <el-table-column label="房源ID" align="center" prop="roomId" />
          <el-table-column label="房源编号" align="center" prop="roomCode" />

          <el-table-column label="业主ID" align="center" prop="ownerId" />
          <el-table-column label="业主姓名" align="center" prop="ownerName" />
          <el-table-column label="租客ID" align="center" prop="tenantId" />

          <el-table-column label="收款类型,1:房租收款 2：租务收款 3：解约结算收款 4：续约结算收款" align="center" prop="receiptType" />

          <el-table-column label="款项" align="center" prop="itemType" />
          <el-table-column label="其它款项
,款项为其它的时候，输入" align="center" prop="otherItemName" />

          <el-table-column label="实收金额" align="center" prop="realPaymentAmount" />
          <el-table-column label="选择账期" align="center" prop="withReceiptPlanId" />
          <el-table-column label="账期开始日" align="center" prop="paymentDaysBegin" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.paymentDaysBegin, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="账期截止日" align="center" prop="paymentDaysEnd" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.paymentDaysEnd, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作人" align="center" prop="createUserid" />
          <el-table-column label="支付方式" align="center" prop="payMethod" />
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <!--  <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['finance:plan:edit']"
              >修改</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['finance:plan:remove']"
              >删除</el-button>
            </template>-->
          </el-table-column>
        </el-table>
      </el-tab-pane>
      <el-tab-pane label="租务收款计划" name="second">
        <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="租房合同号" align="center" prop="contractNo" />
          <el-table-column label="收款单号" align="center" prop="receiptOrderNo" />
          <el-table-column label="承租房间(使用房源名称)" align="center" prop="roomName" />
          <el-table-column label="租客姓名" align="center" prop="tenantName" />
          <el-table-column label="小区名称" align="center" prop="premiseName" />
          <el-table-column label="支付金额" align="center" prop="paymentAmount" />
          <el-table-column label="第几期" align="center" prop="receiptNumber" />
          <el-table-column label="收款状态" align="center" prop="skStatus">
            <template slot-scope="scope">
              <span v-if="scope.row.skStatus==1">未收款</span>
              <span v-if="scope.row.skStatus==2">已收款</span>
              <span v-if="scope.row.skStatus==3">已中止</span>
              <span v-if="scope.row.skStatus==4">已冻结</span>
            </template>
          </el-table-column>
          <el-table-column label="账单类型" align="center" prop="billType">
            <template slot-scope="scope">
              <span v-if="scope.row.billType==1">分期变更</span>
              <span v-if="scope.row.billType==2">租约保理变更</span>
              <span v-if="scope.row.billType==3">退租变更</span>
              <span v-if="scope.row.billType==4">普通账单(正常房租租务计划)</span>
            </template>
          </el-table-column>
          <el-table-column label="预定收款日期" align="center" prop="collectionDate" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.collectionDate, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="实际收款日期" align="center" prop="realCollectionDate" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.realCollectionDate, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>


          <el-table-column label="商户ID" align="center" prop="businessId" />
          <el-table-column label="合同ID" align="center" prop="contractId" />
          <el-table-column label="合同类型1：收房合同，2：出房合同" align="center" prop="contractType" />
          <el-table-column label="解约协议ID" align="center" prop="tTerminationId" />
          <el-table-column label="楼盘ID" align="center" prop="premiseId" />
          <el-table-column label="房源ID" align="center" prop="roomId" />
          <el-table-column label="房源编号" align="center" prop="roomCode" />

          <el-table-column label="业主ID" align="center" prop="ownerId" />
          <el-table-column label="业主姓名" align="center" prop="ownerName" />
          <el-table-column label="租客ID" align="center" prop="tenantId" />

          <el-table-column label="收款类型,1:房租收款 2：租务收款 3：解约结算收款 4：续约结算收款" align="center" prop="receiptType" />

          <el-table-column label="款项" align="center" prop="itemType" />
          <el-table-column label="其它款项
,款项为其它的时候，输入" align="center" prop="otherItemName" />

          <el-table-column label="实收金额" align="center" prop="realPaymentAmount" />
          <el-table-column label="选择账期" align="center" prop="withReceiptPlanId" />
          <el-table-column label="账期开始日" align="center" prop="paymentDaysBegin" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.paymentDaysBegin, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="账期截止日" align="center" prop="paymentDaysEnd" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.paymentDaysEnd, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作人" align="center" prop="createUserid" />
          <el-table-column label="支付方式" align="center" prop="payMethod" />
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
            <!--  <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleUpdate(scope.row)"
                  v-hasPermi="['finance:plan:edit']"
                >修改</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-delete"
                  @click="handleDelete(scope.row)"
                  v-hasPermi="['finance:plan:remove']"
                >删除</el-button>
              </template>-->
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>




    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改收款计划对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="收款单号" prop="receiptOrderNo">
          <el-input v-model="form.receiptOrderNo" placeholder="请输入收款单号" />
        </el-form-item>
        <el-form-item label="商户ID" prop="businessId">
          <el-input v-model="form.businessId" placeholder="请输入商户ID" />
        </el-form-item>
        <el-form-item label="合同ID" prop="contractId">
          <el-input v-model="form.contractId" placeholder="请输入合同ID" />
        </el-form-item>
        <el-form-item label="合同编号" prop="contractNo">
          <el-input v-model="form.contractNo" placeholder="请输入合同编号" />
        </el-form-item>
        <el-form-item label="合同类型1：收房合同，2：出房合同" prop="contractType">
          <el-select v-model="form.contractType" placeholder="请选择合同类型1：收房合同，2：出房合同">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="解约协议ID" prop="tTerminationId">
          <el-input v-model="form.tTerminationId" placeholder="请输入解约协议ID" />
        </el-form-item>
        <el-form-item label="楼盘ID" prop="premiseId">
          <el-input v-model="form.premiseId" placeholder="请输入楼盘ID" />
        </el-form-item>
        <el-form-item label="小区(使用楼盘名)" prop="premiseName">
          <el-input v-model="form.premiseName" placeholder="请输入小区(使用楼盘名)" />
        </el-form-item>
        <el-form-item label="房源ID" prop="roomId">
          <el-input v-model="form.roomId" placeholder="请输入房源ID" />
        </el-form-item>
        <el-form-item label="房源编号" prop="roomCode">
          <el-input v-model="form.roomCode" placeholder="请输入房源编号" />
        </el-form-item>
        <el-form-item label="承租房间(使用房源名称)" prop="roomName">
          <el-input v-model="form.roomName" placeholder="请输入承租房间(使用房源名称)" />
        </el-form-item>
        <el-form-item label="业主ID" prop="ownerId">
          <el-input v-model="form.ownerId" placeholder="请输入业主ID" />
        </el-form-item>
        <el-form-item label="业主姓名" prop="ownerName">
          <el-input v-model="form.ownerName" placeholder="请输入业主姓名" />
        </el-form-item>
        <el-form-item label="租客ID" prop="tenantId">
          <el-input v-model="form.tenantId" placeholder="请输入租客ID" />
        </el-form-item>
        <el-form-item label="租客姓名(面向业主收款时，为空)" prop="tenantName">
          <el-input v-model="form.tenantName" placeholder="请输入租客姓名(面向业主收款时，为空)" />
        </el-form-item>
        <el-form-item label="收款类型
,1:房租收款 2：租务收款 3：解约结算收款 4：续约结算收款" prop="receiptType">
          <el-select v-model="form.receiptType" placeholder="请选择收款类型
,1:房租收款 2：租务收款 3：解约结算收款 4：续约结算收款">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="收款状态
1:未收款 2：已收款 3：已中止  4：已冻结">
          <el-radio-group v-model="form.skStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="账单类型" prop="billType">
          <el-select v-model="form.billType" placeholder="请选择账单类型">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="款项" prop="itemType">
          <el-select v-model="form.itemType" placeholder="请选择款项">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="其它款项
,款项为其它的时候，输入" prop="otherItemName">
          <el-input v-model="form.otherItemName" placeholder="请输入其它款项
,款项为其它的时候，输入" />
        </el-form-item>
        <el-form-item label="支付金额" prop="paymentAmount">
          <el-input v-model="form.paymentAmount" placeholder="请输入支付金额" />
        </el-form-item>
        <el-form-item label="实收金额" prop="realPaymentAmount">
          <el-input v-model="form.realPaymentAmount" placeholder="请输入实收金额" />
        </el-form-item>
        <el-form-item label="选择账期" prop="withReceiptPlanId">
          <el-input v-model="form.withReceiptPlanId" placeholder="请输入选择账期" />
        </el-form-item>
        <el-form-item label="账期开始日" prop="paymentDaysBegin">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.paymentDaysBegin"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择账期开始日">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="账期截止日" prop="paymentDaysEnd">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.paymentDaysEnd"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择账期截止日">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="预定收款日期" prop="collectionDate">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.collectionDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择预定收款日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="实际收款日期" prop="realCollectionDate">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.realCollectionDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择实际收款日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="第几期" prop="receiptNumber">
          <el-input v-model="form.receiptNumber" placeholder="请输入第几期" />
        </el-form-item>
        <el-form-item label="线下支付方式" prop="payMethod">
          <el-input v-model="form.payMethod" placeholder="请输入线下支付方式" />
        </el-form-item>
        <el-form-item label="其它支付方式
,支付方式为其它的时候，输入" prop="otherPayMethod">
          <el-input v-model="form.otherPayMethod" placeholder="请输入其它支付方式
,支付方式为其它的时候，输入" />
        </el-form-item>
        <el-form-item label="支付流水号" prop="payFlowNo">
          <el-input v-model="form.payFlowNo" placeholder="请输入支付流水号" />
        </el-form-item>
        <el-form-item label="账期房租金额" prop="rentalPrice">
          <el-input v-model="form.rentalPrice" placeholder="请输入账期房租金额" />
        </el-form-item>
        <el-form-item label="税费" prop="tax">
          <el-input v-model="form.tax" placeholder="请输入税费" />
        </el-form-item>
        <el-form-item label="操作人" prop="operationUser">
          <el-input v-model="form.operationUser" placeholder="请输入操作人" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="预留字段1" prop="reserve1">
          <el-input v-model="form.reserve1" placeholder="请输入预留字段1" />
        </el-form-item>
        <el-form-item label="预留字段2" prop="reserve2">
          <el-input v-model="form.reserve2" placeholder="请输入预留字段2" />
        </el-form-item>
        <el-form-item label="预留字段3" prop="reserve3">
          <el-input v-model="form.reserve3" placeholder="请输入预留字段3" />
        </el-form-item>
        <el-form-item label="预留字段4" prop="reserve4">
          <el-input v-model="form.reserve4" placeholder="请输入预留字段4" />
        </el-form-item>
        <el-form-item label="预留字段5" prop="reserve5">
          <el-input v-model="form.reserve5" placeholder="请输入预留字段5" />
        </el-form-item>
        <el-form-item label="删除标识
,0:未删除，1：删除" prop="delFlg">
          <el-input v-model="form.delFlg" placeholder="请输入删除标识
,0:未删除，1：删除" />
        </el-form-item>
        <el-form-item label="创建用户ID" prop="createUserid">
          <el-input v-model="form.createUserid" placeholder="请输入创建用户ID" />
        </el-form-item>
        <el-form-item label="更新用户ID" prop="updateUserid">
          <el-input v-model="form.updateUserid" placeholder="请输入更新用户ID" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listPlan, getPlan, delPlan, addPlan, updatePlan,moneyInfo } from "@/api/finance/plan";

export default {
  name: "Plan",
  components: {
  },
  data() {
    return {
      //应收金额
      amountReceivable:null,
      //实收金额
      amountCollected:null,
      //tabs标签
      activeName1:"first",
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 收款计划表格数据
      planList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        receiptOrderNo: null,
        businessId: null,
        contractId: null,
        contractNo: null,
        contractType: null,
        tTerminationId: null,
        premiseId: null,
        premiseName: null,
        roomId: null,
        roomCode: null,
        roomName: null,
        ownerId: null,
        ownerName: null,
        tenantId: null,
        tenantName: null,
        receiptType: null,
        skStatus: null,
        billType: null,
        itemType: null,
        otherItemName: null,
        paymentAmount: null,
        realPaymentAmount: null,
        withReceiptPlanId: null,
        paymentDaysBegin: null,
        paymentDaysEnd: null,
        collectionDate: null,
        realCollectionDate: null,
        receiptNumber: null,
        payMethod: null,
        otherPayMethod: null,
        payFlowNo: null,
        rentalPrice: null,
        tax: null,
        operationUser: null,
        reserve1: null,
        reserve2: null,
        reserve3: null,
        reserve4: null,
        reserve5: null,
        delFlg: null,
        createUserid: null,
        updateUserid: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        receiptOrderNo: [
          { required: true, message: "收款单号不能为空", trigger: "blur" }
        ],
        businessId: [
          { required: true, message: "商户ID不能为空", trigger: "blur" }
        ],
        contractId: [
          { required: true, message: "合同ID不能为空", trigger: "blur" }
        ],
        contractNo: [
          { required: true, message: "合同编号不能为空", trigger: "blur" }
        ],
        contractType: [
          { required: true, message: "合同类型1：收房合同，2：出房合同不能为空", trigger: "change" }
        ],
        premiseId: [
          { required: true, message: "楼盘ID不能为空", trigger: "blur" }
        ],
        premiseName: [
          { required: true, message: "小区(使用楼盘名)不能为空", trigger: "blur" }
        ],
        delFlg: [
          { required: true, message: "删除标识,0:未删除，1：删除不能为空", trigger: "blur" }
        ],
        createUserid: [
          { required: true, message: "创建用户ID不能为空", trigger: "blur" }
        ],
        createTime: [
          { required: true, message: "创建时间不能为空", trigger: "blur" }
        ],
        updateUserid: [
          { required: true, message: "更新用户ID不能为空", trigger: "blur" }
        ],
        updateTime: [
          { required: true, message: "更新时间不能为空", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.getList();
    this.getMoney();
  },
  methods: {
    //获取金额方法
    getMoney() {
      moneyInfo().then(res=>{
        console.log(res)
        this.amountCollected=res.data.amountCollected
        this.amountReceivable=res.data.amountReceivable
      })
    },

    /** tabs标签点击事件 */
    handleClick(tab, event) {
      console.log("=============",tab, event);
      this.activeName1=tab.name;
      this.getList();
    },
    /** 查询收款计划列表 */
    getList() {
      this.loading = true;
      if (this.activeName1 == 'second') {
        this.queryParams.receiptType=2;
      }else {
        this.queryParams.receiptType=1;
      }

      listPlan(this.queryParams).then(response => {
        this.planList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        receiptOrderNo: null,
        businessId: null,
        contractId: null,
        contractNo: null,
        contractType: null,
        tTerminationId: null,
        premiseId: null,
        premiseName: null,
        roomId: null,
        roomCode: null,
        roomName: null,
        ownerId: null,
        ownerName: null,
        tenantId: null,
        tenantName: null,
        receiptType: null,
        skStatus: 0,
        billType: null,
        itemType: null,
        otherItemName: null,
        paymentAmount: null,
        realPaymentAmount: null,
        withReceiptPlanId: null,
        paymentDaysBegin: null,
        paymentDaysEnd: null,
        collectionDate: null,
        realCollectionDate: null,
        receiptNumber: null,
        payMethod: null,
        otherPayMethod: null,
        payFlowNo: null,
        rentalPrice: null,
        tax: null,
        operationUser: null,
        remark: null,
        reserve1: null,
        reserve2: null,
        reserve3: null,
        reserve4: null,
        reserve5: null,
        delFlg: null,
        createUserid: null,
        createTime: null,
        updateUserid: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
   /* /!** 新增按钮操作 *!/
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加收款计划";
    },*/
    /** 修改按钮操作 */
   /* handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getPlan(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改收款计划";
      });
    },*/
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePlan(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPlan(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
   /* handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除收款计划编号为"' + ids + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delPlan(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
    },*/
    /** 导出按钮操作 */
   /* handleExport() {
      this.download('finance/plan/export', {
        ...this.queryParams
      }, `finance_plan.xlsx`)
    }*/
  }
};
</script>
